{% extends "approval/base.html" %}
{% block title %} 项目列表 {% endblock %}
{% block content %}
    <section class="panel panel-default" style="margin: 10px">
        <div class="panel-body">
            <div class="col-12" style="padding: 10px">
                <form class="form-inline" role="search" action="{{ request.path }}" type="get">
                    <div class="form-group">
                        <input type="text" class="form-control" name="search" value="{{ request.GET.search }}">
                    </div>
                    <button type="submit" class="btn btn-info">搜索</button>
                </form>
            </div>
        </div>
    </section>
    <section class="wrapper">
        <section class="panel">
            <div class="panel-body table-responsive">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th style="white-space: nowrap">ID</th>
                        <th style="white-space: nowrap">编号</th>
                        <th style="white-space: nowrap">名称</th>
                        <th>描述</th>
                        <th style="white-space: nowrap">状态</th>
                        <th style="white-space: nowrap">时间段</th>
                        <th style="white-space: nowrap">预算/元</th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for row in object_list %}
                        <tr>
                            <td style="white-space: nowrap">{{ row.pk }}</td>
                            <td style="white-space: nowrap"><a href="{% url 'approval:project' row.pk %}">{{ row.code }}</a></td>
                            <td>{{ row.name }}</td>
                            <td>{{ row.desc|default_if_none:"" }}</td>
                            <td style="white-space: nowrap">{{ row.get_status_display }}</td>
                            <td style="white-space: nowrap">{% if row.date_start %}开始: {{ row.date_start }}{% endif %}{% if row.date_start and row.date_finish %}<br>{% endif %}{% if row.date_finish %}截止: {{ row.date_finish }}{% endif %}</td>
                            <td style="white-space: nowrap">{{ row.predict_amount|default_if_none:"" }}</td>
                            <td></td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            <div class="text-right">
                {% include 'pagination.html' %}
            </div>
            </div>
        </section>
    </section>
{% endblock %}